function checkFrm() {
    $("#submitBtn").html("正在提交...");
    $("#submitBtn").addClass("layui-btn-disabled");
}
var optionTmp = {
    type: "post",
    dataType: "json",
    beforeSubmit: checkFrm,
    url: doAddUrl,
    success: function (data) {
        dialog.alert(data.msg);
        if (data.flag) {
            //window.location.href = listUrl;
            setTimeout(function () {
                window.parent.location.reload();
            }, 1000);

        } else {
            $("#submitBtn").html("确定提交");
            $("#submitBtn").removeClass("layui-btn-disabled");
        }
    },
    error: function () {
        dialog.alert("接口异常");
        $("#submitBtn").html("确定提交");
        $("#submitBtn").removeClass("layui-btn-disabled");
    }
};

$("#submitBtn").click(function () {
    $("#addFrm").ajaxSubmit(optionTmp);
});


function tongji() {
    var unit_fee = $("#unit_fee").val();
    var num = $("#num").val();
    var total_fee = unit_fee * num;
    $("#total_fee").val(parseFloat(total_fee.toFixed(2)));
}

function changeFeeType(fee_type) {
    if (fee_type == 2) {
        $("#mileage_info").show();
        $("#transport_type_dom").show();
        if (id == 0) {
            $.ajax({
                type: "GET",
                dataType: "json",
                url: getPreMileageUrl,
                data: {
                    order_id: order_id
                },
                success: function (data) {
                    if (data.flag == 1) {
                        $("#start_mileage").val(data.end_mileage);
                    } else {
                        dialog.alert(data.msg);
                    }
                }
            });
        }
    }else{
        $("#mileage_info").hide();
        $("#transport_type_dom").hide();
    }
}

function changeUnit(unit) {
    if (unit == 4) {
        if (id == 0) {
            $.ajax({
                type: "GET",
                dataType: "json",
                url: getOrderWeightUrl,
                data: {
                    order_id: order_id
                },
                success: function (data) {
                    if (data.flag == 1) {
                        $("#num").val(data.weight);
                    } else {
                        dialog.alert(data.msg);
                    }
                }
            });
        }
    }
}